package jou.cs.controller;

import jou.cs.entity.TPlace;
import jou.cs.service.PlaceService;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@RequestMapping("place")
public class place {
    @Resource
    private PlaceService service;

    @GetMapping
    Object detail(@RequestParam Long pid) {
        Map<Object, Object> placeById = service.getPlaceById(pid);
        return placeById;
    }

    @GetMapping("{page}")
    Object gls(@PathVariable int page) {
        // select page
        Page<TPlace> all = service.getPlaceByPage(page - 1);
        return all.getContent();
    }

    // 修改
    @PutMapping("{id}")
    Object update(@PathVariable String id) {
        return null;
    }

}
